package com.cyou.gamehistory.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.cyou.gamehistory.util.WebUtil;

/**
 * 用户登录拦截器
 * 
 * @author wangzhang date 2012-12-24 下午7:14:51
 */
public class FrontUserLoginInterceptor extends HandlerInterceptorAdapter {

	private Logger log = Logger.getLogger(this.getClass());

	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		if (!WebUtil.isLogin(request, response)) {
			log.info("前台未登陆...");
			request.getRequestDispatcher("/f/login").forward(request, response);
			return false;
		}
		return true;
	}

}
